<template>
  <div class="home">
     <!-- input组件 -->
     <my-input v-model="title">
            <van-button type="primary" size="mini" @click="add">添加任务</van-button>
     </my-input>
     <!-- 列表 -->
     <myList></myList>
    
  </div>
</template>

<script>
import myInput from '../components/myInput'
import myList from '../components/myList'
import {mapMutations} from 'vuex'
export default {
  name: 'HomeView',
  data() {
    return {
        title:''
    }
  },
  methods: {
    add(){
        this.addTask(this.title)
        this.title = ''
    },
    ...mapMutations(['addTask'])
  },
  components: {
    myInput,
    myList
  }
}
</script>
